package com.rizzo.back.service.impl;

import com.rizzo.back.dao.BlogEntryDao;
import com.rizzo.back.domain.BlogEntry;
import com.rizzo.back.domain.BlogUser;
import com.rizzo.back.exception.ApplicationException;
import com.rizzo.back.service.BlogEntryService;
import com.rizzo.back.util.search.SearchDataObject;
import org.apache.lucene.queryParser.ParseException;

import java.io.IOException;
import java.util.Date;
import java.util.List;

/**
 * TODO Insert JavaDoc!
 */
public class BlogEntryServiceImpl implements BlogEntryService {

    private BlogEntryDao blogEntryDao;

    /**
     * {@inheritDoc}
     */
    public List<BlogEntry> getBlogEntriesOfBlogUser(BlogUser blogUser, Date startCreateDate, Date endCreateDate, boolean published) throws ApplicationException {
        return null;
    }

    /**
     * {@inheritDoc}
     */
    public List<BlogEntry> searchBlogEntriesOfBlogUser(BlogUser blogUser, SearchDataObject searchDataObject) throws ApplicationException {
        List<BlogEntry> blogEntries = null;
        try {
            blogEntries = this.blogEntryDao.getSearchBlogEntriesForBlogUser(searchDataObject, blogUser);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return blogEntries;
    }

    /**
     * Method setBlogEntryDao sets the blogEntryDao of this BlogEntryServiceImpl object
     *
     * @param blogEntryDao of type BlogEntryDao
     */
    public void setBlogEntryDao(BlogEntryDao blogEntryDao) {
        this.blogEntryDao = blogEntryDao;
    }
    
}
